package com.songlanyun.common.enums;

import java.util.Objects;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonValue;
import com.songlanyun.common.drive.IntegerEnum;

/**
 * 协议管理相关枚举 0服务协议 1隐私协议 2申领规则 3关于我们
 *
 * @author lijiahe 2022-08-05
 */
public class ProtocolConfigConstant {

    /**
     * 审核状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public static enum TypeEnum implements IntegerEnum<String> {
        // 类型 service-agreement服务协议 privacy-agreement隐私协议 claiming-rules申领规则 about-us关于我们
        SERVICE_AGREEMENT("service-agreement", "服务协议"), PRIVACY_AGREEMENT("privacy-agreement", "隐私协议"),
        CLAIMING_RULES("claiming-rules", "申领规则"), ABOUT_US("about-us", "关于我们"),;

        @EnumValue
        @JsonValue
        private String code;

        private String msg;

        TypeEnum(String code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        @JsonCreator
        public static ProtocolConfigConstant.TypeEnum getByCode(String code) {
            for (ProtocolConfigConstant.TypeEnum value : ProtocolConfigConstant.TypeEnum.values()) {
                if (Objects.equals(code, value.getCode())) {
                    return value;
                }
            }
            return null;
        }

        @Override
        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        @Override
        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

    }
}
